import React from "react";
import PropTypes from 'prop-types';
import  './index.scss'

export default function Button(props) {
    return (
        <button style={ props.style }
                className={ props.className + ' btn ' + props.color + (props.plain ? ' plain ' : ' ') + props.size }
                onClick={ props.onClick }
        >
            { props.icon ? (<i className={props.icon} />) : (<></>) }
            <span>{props.children}</span>
        </button>
    )
}

Button.propTypes = {
    style: PropTypes.object,
    className: PropTypes.string,
    color: PropTypes.string,
    plain: PropTypes.bool,
    size: PropTypes.string,
    icon: PropTypes.string,
    onClick: PropTypes.func
}

Button.defaultProps = {
    style: {},
    className: '',
    color: 'blue',
    plain: false,
    size: '',
    onClick: () => {}
}